home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 26 / CU Amiga Magazine's Super CD-ROM 26 (1998)(EMAP Images)(GB)[!][issue 1998-09].iso / CUCD / PowerPC / uae-0.8.4 / aclocal.m4 < prev    next >
Text File  |  1998-06-03  |  19KB  |  591 lines

  1. # Configure paths for GTK+
  2. # Owen Taylor     97-11-3
  3.  
  4. dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
  5. dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
  6. dnl
  7. AC_DEFUN(AM_PATH_GTK,
  8. [dnl 
  9. dnl Get the cflags and libraries from the gtk-config script
  10. dnl
  11. AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
  12.             gtk_config_prefix="$withval", gtk_config_prefix="")
  13. AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
  14.             gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
  15. AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
  16.             , enable_gtktest=yes)
  17.  
  18.   if test x$gtk_config_exec_prefix != x ; then
  19.      gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
  20.      if test x${GTK_CONFIG+set} != xset ; then
  21.         GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
  22.      fi
  23.   fi
  24.   if test x$gtk_config_prefix != x ; then
  25.      gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
  26.      if test x${GTK_CONFIG+set} != xset ; then
  27.         GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
  28.      fi
  29.   fi
  30.  
  31.   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
  32.   min_gtk_version=ifelse([$1], ,0.99.7,$1)
  33.   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
  34.   no_gtk=""
  35.   if test "$GTK_CONFIG" = "no" ; then
  36.     no_gtk=yes
  37.   else
  38.     GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
  39.     GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
  40.     gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
  41.            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
  42.     gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
  43.            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
  44.     gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
  45.            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
  46.     if test "x$enable_gtktest" = "xyes" ; then
  47.       ac_save_CFLAGS="$CFLAGS"
  48.       ac_save_LIBS="$LIBS"
  49.       CFLAGS="$CFLAGS $GTK_CFLAGS"
  50.       LIBS="$LIBS $GTK_LIBS"
  51. dnl
  52. dnl Now check if the installed GTK is sufficiently new. (Also sanity
  53. dnl checks the results of gtk-config to some extent
  54. dnl
  55.       rm -f conf.gtktest
  56.       AC_TRY_RUN([
  57. #include <gtk/gtk.h>
  58. #include <stdio.h>
  59.  
  60. int 
  61. main ()
  62. {
  63.   int major, minor, micro;
  64.  
  65.   system ("touch conf.gtktest");
  66.  
  67.   if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) {
  68.      printf("%s, bad version string\n", "$min_gtk_version");
  69.      exit(1);
  70.    }
  71.  
  72.   if ((gtk_major_version != $gtk_config_major_version) ||
  73.       (gtk_minor_version != $gtk_config_minor_version) ||
  74.       (gtk_micro_version != $gtk_config_micro_version))
  75.     {
  76.       printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
  77.              $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
  78.              gtk_major_version, gtk_minor_version, gtk_micro_version);
  79.       printf ("*** was found! If gtk-config was correct, then it is best\n");
  80.       printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
  81.       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
  82.       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
  83.       printf("*** required on your system.\n");
  84.       printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
  85.       printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
  86.       printf("*** before re-running configure\n");
  87.     } 
  88.   else
  89.     {
  90.       if ((gtk_major_version > major) ||
  91.         ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
  92.         ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
  93.       {
  94.         return 0;
  95.        }
  96.      else
  97.       {
  98.         printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
  99.                gtk_major_version, gtk_minor_version, gtk_micro_version);
  100.         printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
  101.            major, minor, micro);
  102.         printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
  103.         printf("***\n");
  104.         printf("*** If you have already installed a sufficiently new version, this error\n");
  105.         printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
  106.         printf("*** being found. The easiest way to fix this is to remove the old version\n");
  107.         printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
  108.         printf("*** correct copy of gtk-config. (In this case, you will have to\n");
  109.         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
  110.         printf("*** so that the correct libraries are found at run-time))\n");
  111.       }
  112.     }
  113.   return 1;
  114. }
  115. ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  116.        CFLAGS="$ac_save_CFLAGS"
  117.        LIBS="$ac_save_LIBS"
  118.      fi
  119.   fi
  120.   if test "x$no_gtk" = x ; then
  121.      AC_MSG_RESULT(yes)
  122.      ifelse([$2], , :, [$2])     
  123.   else
  124.      AC_MSG_RESULT(no)
  125.      if test "$GTK_CONFIG" = "no" ; then
  126.        echo "*** The gtk-config script installed by GTK could not be found"
  127.        echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
  128.        echo "*** your path, or set the GTK_CONFIG environment variable to the"
  129.        echo "*** full path to gtk-config."
  130.      else
  131.        if test -f conf.gtktest ; then
  132.         :
  133.        else
  134.           echo "*** Could not run GTK test program, checking why..."
  135.           CFLAGS="$CFLAGS $GTK_CFLAGS"
  136.           LIBS="$LIBS $GTK_LIBS"
  137.           AC_TRY_LINK([
  138. #include <gtk/gtk.h>
  139. #include <stdio.h>
  140. ],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
  141.         [ echo "*** The test program compiled, but did not run. This usually means"
  142.           echo "*** that the run-time linker is not finding GTK or finding the wrong"
  143.           echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
  144.           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  145.           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
  146.           echo "*** is required on your system"
  147.       echo "***"
  148.           echo "*** If you have an old version installed, it is best to remove it, although"
  149.           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
  150.           echo "***"
  151.           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
  152.           echo "*** came with the system with the command"
  153.           echo "***"
  154.           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
  155.         [ echo "*** The test program failed to compile or link. See the file config.log for the"
  156.           echo "*** exact error that occured. This usually means GTK was incorrectly installed"
  157.           echo "*** or that you have moved GTK since it was installed. In the latter case, you"
  158.           echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
  159.           CFLAGS="$ac_save_CFLAGS"
  160.           LIBS="$ac_save_LIBS"
  161.        fi
  162.      fi
  163.      GTK_CFLAGS=""
  164.      GTK_LIBS=""
  165.      ifelse([$3], , :, [$3])
  166.   fi
  167.   AC_SUBST(GTK_CFLAGS)
  168.   AC_SUBST(GTK_LIBS)
  169.   rm -f conf.gtktest
  170. ])
  171. dnl
  172. dnl GNOME_FILEUTILS_CHECKS
  173. dnl
  174. dnl checks that are needed for the diskusage applet.
  175. dnl
  176.  
  177. AC_DEFUN([GNOME_FILEUTILS_CHECKS],
  178. [    
  179. AC_CHECK_HEADERS(fcntl.h sys/param.h sys/statfs.h sys/fstyp.h \
  180. mnttab.h mntent.h sys/statvfs.h sys/vfs.h sys/mount.h \
  181. sys/filsys.h sys/fs_types.h sys/fs/s5param.h)
  182.  
  183. AC_CHECK_FUNCS(bcopy endgrent endpwent fchdir ftime ftruncate \
  184. getcwd getmntinfo gettimeofday isascii lchown \
  185. listmntent memcpy mkfifo strchr strerror strrchr)
  186.  
  187. # Determine how to get the list of mounted filesystems.
  188. list_mounted_fs=
  189.  
  190. # If the getmntent function is available but not in the standard library,
  191. # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
  192. AC_FUNC_GETMNTENT
  193.  
  194. # This test must precede the ones for getmntent because Unicos-9 is
  195. # reported to have the getmntent function, but its support is incompatible
  196. # with other getmntent implementations.
  197.  
  198. # NOTE: Normally, I wouldn't use a check for system type as I've done for
  199. # `CRAY' below since that goes against the whole autoconf philosophy.  But
  200. # I think there is too great a chance that some non-Cray system has a
  201. # function named listmntent to risk the false positive.
  202.  
  203. if test -z "$list_mounted_fs"; then
  204. # Cray UNICOS 9
  205. AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
  206. AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
  207. [fu_cv_sys_mounted_cray_listmntent=no
  208. AC_EGREP_CPP(yes,
  209. [#ifdef _CRAY
  210. yes
  211. #endif
  212. ], [test $ac_cv_func_listmntent = yes \
  213. && fu_cv_sys_mounted_cray_listmntent=yes]
  214. )
  215. ]
  216. )
  217. AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
  218. if test $fu_cv_sys_mounted_cray_listmntent = yes; then
  219. list_mounted_fs=found
  220. AC_DEFINE(MOUNTED_LISTMNTENT)
  221. fi
  222. fi
  223.  
  224. if test $ac_cv_func_getmntent = yes; then
  225.  
  226. # This system has the getmntent function.
  227. # Determine whether it's the one-argument variant or the two-argument one.
  228.  
  229. if test -z "$list_mounted_fs"; then
  230. # 4.3BSD, SunOS, HP-UX, Dynix, Irix
  231. AC_MSG_CHECKING([for one-argument getmntent function])
  232. AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
  233. [test $ac_cv_header_mntent_h = yes \
  234. && fu_cv_sys_mounted_getmntent1=yes \
  235. || fu_cv_sys_mounted_getmntent1=no])
  236. AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
  237. if test $fu_cv_sys_mounted_getmntent1 = yes; then
  238. list_mounted_fs=found
  239. AC_DEFINE(MOUNTED_GETMNTENT1)
  240. fi
  241. fi
  242.  
  243. if test -z "$list_mounted_fs"; then
  244. # SVR4
  245. AC_MSG_CHECKING([for two-argument getmntent function])
  246. AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
  247. [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
  248. fu_cv_sys_mounted_getmntent2=yes,
  249. fu_cv_sys_mounted_getmntent2=no)])
  250. AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
  251. if test $fu_cv_sys_mounted_getmntent2 = yes; then
  252. list_mounted_fs=found
  253. AC_DEFINE(MOUNTED_GETMNTENT2)
  254. fi
  255. fi
  256.  
  257. if test -z "$list_mounted_fs"; then
  258. AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
  259. fi
  260.  
  261. fi
  262.  
  263. if test -z "$list_mounted_fs"; then
  264. # DEC Alpha running OSF/1.
  265. AC_MSG_CHECKING([for getfsstat function])
  266. AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
  267. [AC_TRY_LINK([
  268. #include <sys/types.h>
  269. #include <sys/mount.h>
  270. #include <sys/fs_types.h>],
  271. [struct statfs *stats;
  272. int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
  273. fu_cv_sys_mounted_getsstat=yes,
  274. fu_cv_sys_mounted_getsstat=no)])
  275. AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
  276. if test $fu_cv_sys_mounted_getsstat = yes; then
  277. list_mounted_fs=found
  278. AC_DEFINE(MOUNTED_GETFSSTAT)
  279. fi
  280. fi
  281.  
  282. if test -z "$list_mounted_fs"; then
  283. # AIX.
  284. AC_MSG_CHECKING([for mntctl function and struct vmount])
  285. AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
  286. [AC_TRY_CPP([#include <fshelp.h>],
  287. fu_cv_sys_mounted_vmount=yes,
  288. fu_cv_sys_mounted_vmount=no)])
  289. AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
  290. if test $fu_cv_sys_mounted_vmount = yes; then
  291. list_mounted_fs=found
  292. AC_DEFINE(MOUNTED_VMOUNT)
  293. fi
  294. fi
  295.  
  296. if test -z "$list_mounted_fs"; then
  297. # SVR3
  298. AC_MSG_CHECKING([for FIXME existence of three headers])
  299. AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
  300. [AC_TRY_CPP([
  301. #include <sys/statfs.h>
  302. #include <sys/fstyp.h>
  303. #include <mnttab.h>],
  304. fu_cv_sys_mounted_fread_fstyp=yes,
  305. fu_cv_sys_mounted_fread_fstyp=no)])
  306. AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
  307. if test $fu_cv_sys_mounted_fread_fstyp = yes; then
  308. list_mounted_fs=found
  309. AC_DEFINE(MOUNTED_FREAD_FSTYP)
  310. fi
  311. fi
  312.  
  313. if test -z "$list_mounted_fs"; then
  314. # 4.4BSD and DEC OSF/1.
  315. AC_MSG_CHECKING([for getmntinfo function])
  316. AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
  317. [
  318. ok=
  319. if test $ac_cv_func_getmntinfo = yes; then
  320. AC_EGREP_HEADER(f_type;, sys/mount.h,
  321. ok=yes)
  322. fi
  323. test -n "$ok" \
  324. && fu_cv_sys_mounted_getmntinfo=yes \
  325. || fu_cv_sys_mounted_getmntinfo=no
  326. ])
  327. AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
  328. if test $fu_cv_sys_mounted_getmntinfo = yes; then
  329. list_mounted_fs=found
  330. AC_DEFINE(MOUNTED_GETMNTINFO)
  331. fi
  332. fi
  333.  
  334. # FIXME: add a test for netbsd-1.1 here
  335.  
  336. if test -z "$list_mounted_fs"; then
  337. # Ultrix
  338. AC_MSG_CHECKING([for getmnt function])
  339. AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
  340. [AC_TRY_CPP([
  341. #include <sys/fs_types.h>
  342. #include <sys/mount.h>],
  343. fu_cv_sys_mounted_getmnt=yes,
  344. fu_cv_sys_mounted_getmnt=no)])
  345. AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
  346. if test $fu_cv_sys_mounted_getmnt = yes; then
  347. list_mounted_fs=found
  348. AC_DEFINE(MOUNTED_GETMNT)
  349. fi
  350. fi
  351.  
  352. if test -z "$list_mounted_fs"; then
  353. # SVR2
  354. AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
  355. AC_CACHE_VAL(fu_cv_sys_mounted_fread,
  356. [AC_TRY_CPP([#include <mnttab.h>],
  357. fu_cv_sys_mounted_fread=yes,
  358. fu_cv_sys_mounted_fread=no)])
  359. AC_MSG_RESULT($fu_cv_sys_mounted_fread)
  360. if test $fu_cv_sys_mounted_fread = yes; then
  361. list_mounted_fs=found
  362. AC_DEFINE(MOUNTED_FREAD)
  363. fi
  364. fi
  365.  
  366. if test -z "$list_mounted_fs"; then
  367. AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
  368. # FIXME -- no need to abort building the whole package
  369. # Can't build mountlist.c or anything that needs its functions
  370. fi
  371.  
  372. AC_CHECKING(how to get filesystem space usage)
  373. space=no
  374.  
  375. # Perform only the link test since it seems there are no variants of the
  376. # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
  377. # because that got a false positive on SCO OSR5.  Adding the declaration
  378. # of a `struct statvfs' causes this test to fail (as it should) on such
  379. # systems.  That system is reported to work fine with STAT_STATFS4 which
  380. # is what it gets when this test fails.
  381. if test $space = no; then
  382. # SVR4
  383. AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
  384. [AC_TRY_LINK([#include <sys/types.h>
  385. #include <sys/statvfs.h>],
  386. [struct statvfs fsd; statvfs (0, &fsd);],
  387. fu_cv_sys_stat_statvfs=yes,
  388. fu_cv_sys_stat_statvfs=no)])
  389. if test $fu_cv_sys_stat_statvfs = yes; then
  390. space=yes
  391. AC_DEFINE(STAT_STATVFS)
  392. fi
  393. fi
  394.  
  395. if test $space = no; then
  396. # DEC Alpha running OSF/1
  397. AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
  398. AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
  399. [AC_TRY_RUN([
  400. #include <sys/param.h>
  401. #include <sys/types.h>
  402. #include <sys/mount.h>
  403. main ()
  404. {
  405. struct statfs fsd;
  406. fsd.f_fsize = 0;
  407. exit (statfs (".", &fsd, sizeof (struct statfs)));
  408. }],
  409. fu_cv_sys_stat_statfs3_osf1=yes,
  410. fu_cv_sys_stat_statfs3_osf1=no,
  411. fu_cv_sys_stat_statfs3_osf1=no)])
  412. AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
  413. if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
  414. space=yes
  415. AC_DEFINE(STAT_STATFS3_OSF1)
  416. fi
  417. fi
  418.  
  419. if test $space = no; then
  420. # AIX
  421. AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
  422. member (AIX, 4.3BSD)])
  423. AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
  424. [AC_TRY_RUN([
  425. #ifdef HAVE_SYS_PARAM_H
  426. #include <sys/param.h>
  427. #endif
  428. #ifdef HAVE_SYS_MOUNT_H
  429. #include <sys/mount.h>
  430. #endif
  431. #ifdef HAVE_SYS_VFS_H
  432. #include <sys/vfs.h>
  433. #endif
  434. main ()
  435. {
  436. struct statfs fsd;
  437. fsd.f_bsize = 0;
  438. exit (statfs (".", &fsd));
  439. }],
  440. fu_cv_sys_stat_statfs2_bsize=yes,
  441. fu_cv_sys_stat_statfs2_bsize=no,
  442. fu_cv_sys_stat_statfs2_bsize=no)])
  443. AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
  444. if test $fu_cv_sys_stat_statfs2_bsize = yes; then
  445. space=yes
  446. AC_DEFINE(STAT_STATFS2_BSIZE)
  447. fi
  448. fi
  449.  
  450. if test $space = no; then
  451. # SVR3
  452. AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
  453. AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
  454. [AC_TRY_RUN([#include <sys/types.h>
  455. #include <sys/statfs.h>
  456. main ()
  457. {
  458. struct statfs fsd;
  459. exit (statfs (".", &fsd, sizeof fsd, 0));
  460. }],
  461. fu_cv_sys_stat_statfs4=yes,
  462. fu_cv_sys_stat_statfs4=no,
  463. fu_cv_sys_stat_statfs4=no)])
  464. AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
  465. if test $fu_cv_sys_stat_statfs4 = yes; then
  466. space=yes
  467. AC_DEFINE(STAT_STATFS4)
  468. fi
  469. fi
  470.  
  471. if test $space = no; then
  472. # 4.4BSD and NetBSD
  473. AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
  474. member (4.4BSD and NetBSD)])
  475. AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
  476. [AC_TRY_RUN([#include <sys/types.h>
  477. #ifdef HAVE_SYS_PARAM_H
  478. #include <sys/param.h>
  479. #endif
  480. #ifdef HAVE_SYS_MOUNT_H
  481. #include <sys/mount.h>
  482. #endif
  483. main ()
  484. {
  485. struct statfs fsd;
  486. fsd.f_fsize = 0;
  487. exit (statfs (".", &fsd));
  488. }],
  489. fu_cv_sys_stat_statfs2_fsize=yes,
  490. fu_cv_sys_stat_statfs2_fsize=no,
  491. fu_cv_sys_stat_statfs2_fsize=no)])
  492. AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
  493. if test $fu_cv_sys_stat_statfs2_fsize = yes; then
  494. space=yes
  495. AC_DEFINE(STAT_STATFS2_FSIZE)
  496. fi
  497. fi
  498.  
  499. if test $space = no; then
  500. # Ultrix
  501. AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
  502. AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
  503. [AC_TRY_RUN([#include <sys/types.h>
  504. #ifdef HAVE_SYS_PARAM_H
  505. #include <sys/param.h>
  506. #endif
  507. #ifdef HAVE_SYS_MOUNT_H
  508. #include <sys/mount.h>
  509. #endif
  510. #ifdef HAVE_SYS_FS_TYPES_H
  511. #include <sys/fs_types.h>
  512. #endif
  513. main ()
  514. {
  515. struct fs_data fsd;
  516. /* Ultrix's statfs returns 1 for success,
  517. 0 for not mounted, -1 for failure.  */
  518. exit (statfs (".", &fsd) != 1);
  519. }],
  520. fu_cv_sys_stat_fs_data=yes,
  521. fu_cv_sys_stat_fs_data=no,
  522. fu_cv_sys_stat_fs_data=no)])
  523. AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
  524. if test $fu_cv_sys_stat_fs_data = yes; then
  525. space=yes
  526. AC_DEFINE(STAT_STATFS2_FS_DATA)
  527. fi
  528. fi
  529.  
  530. if test $space = no; then
  531. # SVR2
  532. AC_TRY_CPP([#include <sys/filsys.h>],
  533. AC_DEFINE(STAT_READ_FILSYS) space=yes)
  534. fi
  535.  
  536. if test -n "$list_mounted_fs" && test $space != no; then
  537. DF_PROG="df"
  538. LIBOBJS="$LIBOBJS fsusage.o"
  539. LIBOBJS="$LIBOBJS mountlist.o"
  540. fi
  541.  
  542. AC_CHECK_FUNCS(ftruncate, , [ftruncate_missing=yes])
  543.  
  544. if test "$ftruncate_missing" = yes; then
  545. AC_MSG_CHECKING([fcntl emulation of ftruncate])
  546. AC_CACHE_VAL(fu_cv_sys_ftruncate_emulation,
  547. [AC_TRY_LINK([
  548. #include <sys/types.h>
  549. #include <fcntl.h>], [
  550. #if !defined(F_CHSIZE) && !defined(F_FREESP)
  551. chsize();
  552. #endif
  553. ],
  554. fu_cv_sys_ftruncate_emulation=yes,
  555. fu_cv_sys_ftruncate_emulation=no)])
  556. AC_MSG_RESULT($fu_cv_sys_ftruncate_emulation)
  557. if test $fu_cv_sys_ftruncate_emulation = yes; then
  558. LIBOBJS="$LIBOBJS ftruncate.o"
  559. fi
  560. fi
  561.  
  562. case "$LIBOBJS" in
  563. *rename.o*)
  564. MVDIR_PROG="mvdir"
  565. ;;
  566. esac
  567.  
  568. # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
  569. # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
  570. # enable the work-around code in fsusage.c.
  571. AC_MSG_CHECKING([for statfs that truncates block counts])
  572. AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
  573. [AC_TRY_COMPILE([
  574. #if !defined(sun) && !defined(__sun)
  575. choke -- this is a workaround for a Sun-specific problem
  576. #endif
  577. #include <sys/types.h>
  578. #include <sys/vfs.h>],
  579. [struct statfs t; long c = *(t.f_spare);],
  580. fu_cv_sys_truncating_statfs=yes,
  581. fu_cv_sys_truncating_statfs=no,
  582. )])
  583. if test $fu_cv_sys_truncating_statfs = yes; then
  584. AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS)
  585. fi
  586. AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
  587.  
  588. AC_CHECKING(for AFS)
  589. test -d /afs && AC_DEFINE(AFS)
  590. ])
  591.